<!--
 * @Description:
 * @Author: cgt
 * @Date: 2021-12-23 14:05:56
 * @LastEditors: cgt
 * @LastEditTime: 2021-12-28 19:57:27
-->
<template>
  <div>
    <el-button @click="show">显示</el-button>
    <el-button @click="hide">隐藏</el-button>

    <div class="overview-map-container" v-show="visible">
      <div ref="overviewMap" class="overview-map"></div>
    </div>
  </div>
</template>

<script>
import mixins from '../mixins';
export default {
  name: 'OverviewTool',
  props: {
    getTool: {
      type: Function,
      required: true
    }
  },
  mixins: [mixins],
  data() {
    return {
      visible: false
    };
  },
  methods: {
    show() {
      this.visible = true;
      this.$nextTick(() => {
        this.getTool('OverviewTool').init(this.$refs.overviewMap);
      });
    },
    hide() {
      this.getTool('OverviewTool').remove();
      this.visible = false;
    }
  },
  mounted() {}
};
</script>

<style scoped>
.overview-map-container {
  position: fixed;
  bottom: 10px;
  right: 55px;
  width: 600px;
  height: 400px;
  border: 2px solid #bbbbbb;
  overflow: auto;
  z-index: 1;
}
.overview-map {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
}
.overview-map >>> .sgmap-logo-wrap .sgmap-logo-copyright {
  margin: 0 0 0 72px;
}
</style>
